<?php
/**
 * NAME: echo_say
 * WHEN: OnMsg
 * PROVIDES: !m !say !saychannel !priv !echo !ppriv !psay !psaychannel
 * AUTOLOAD: true
 * DESCRIPTION: Wysyłanie wiadomości (przedrostek 'p' - parsowanie wiadomosci przed wyslaniem)
 * VERSION: 0.1
 * UPDATE: http://update.tempaq2.blacksoft.eu/check.php
 * AUTHOR: blacksoft.eu
 */
  
 exit();
 
//*function_start
	switch($d[0]) {
		case '!say':
		case '!echo':
			if (isset($d[1])) {
				$bot->send(substr($message, strpos($message, $d[1])));
			}
			break;
		case '!priv':
		case '!m':
			if (isset($d[1])&&isset($d[2])) {
				$bot->sendpriv(substr($message, strpos($message, $d[2])), $d[1]);
			}
			break;
		case '!saychannel':
			if (isset($d[1])&&isset($d[2])) {
				$bot->sendmessage(substr($message, strpos($message, $d[2])), $d[1]);
			}
			break;
		case '!say_all':
		case '!sayall':
			if ($bot->is_admin($data->nick)) {
				$msg = substr($message, strpos($message, $d[2]));
				foreach ($bot->irc->channel as $c) {
					$bot->sendmessage($msg, $c->name);
				}
			}
			break;			
		case '!psay':
	//	case '!parse':
			if (isset($d[1])) {
				$msg = substr($message, strpos($message, $d[1]));
				$nowedata = $data;
				$nowedata->message = $msg;
				$nowedata->messageex = explode(' ', $msg);
				$nowedata->rawmessage = str_replace($message, $msg, $data->rawmessage);
				$nowedata->rawmessageex = explode(' ', $nowedata->rawmessage);
				$bot->onchannelmessage($irc, $nowedata);
			}
			break;
		case '!psaychannel':
			if (isset($d[1]) && isset($d[2])) {
				$msg = substr($message, strpos($message, $d[2]));
				$nowedata = $data;
				$nowedata->message = $msg;
				$nowedata->channel = $d[1];
				$nowedata->type = 2;
				$nowedata->messageex = explode(' ', $msg);
				$nowedata->rawmessage = ereg_replace('PRIVMSG ([^ ]*) :', 'PRIVMSG '.$d[1].' :', $nowedata->rawmessage);
				$nowedata->rawmessage = str_replace($message, $msg, $data->rawmessage);
				$nowedata->rawmessageex = explode(' ', $nowedata->rawmessage);
				$bot->onchannelmessage($irc, $nowedata);
			}
			break;
		case '!ppriv':
			if (isset($d[1]) && isset($d[2])) {
				$msg = substr($message, strpos($message, $d[2]));
				$nowedata = $data;
				$nowedata->nick = $d[1];
				$nowedata->message = $msg;
				$nowedata->channel = '';
				$nowedata->type = 4;
				$nowedata->messageex = explode(' ', $msg);
			//	$nowedata->rawmessage = ereg_replace('PRIVMSG ([^ ]*) :', 'PRIVMSG '.$d[1].' :', $nowedata->rawmessage);
				$nowedata->rawmessage = str_replace($message, $msg, $data->rawmessage);
				$nowedata->rawmessageex = explode(' ', $nowedata->rawmessage);
				$bot->onchannelmessage($irc, $nowedata);
			}
			break;
	}
//*function_end
?>